package cn.exrick.xboot.modules.oauthClient.serviceimpl;

import cn.exrick.xboot.modules.oauthClient.dao.mapper.OauthClientDetailsMapper;
import cn.exrick.xboot.modules.oauthClient.entity.OauthClientDetails;
import cn.exrick.xboot.modules.oauthClient.service.IOauthClientDetailsService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Oauth客户端管理接口实现
 * @author portal
 */
@Slf4j
@Service
@Transactional
public class IOauthClientDetailsServiceImpl extends ServiceImpl<OauthClientDetailsMapper, OauthClientDetails> implements IOauthClientDetailsService {

    @Autowired
    private OauthClientDetailsMapper oauthClientDetailsMapper;

    @Override
    public OauthClientDetails getByClientId(String clientId) {
        return oauthClientDetailsMapper.getByClientId(clientId);
    }

    @Override
    public OauthClientDetails getByOldClientId(String oldClientId) {
        return oauthClientDetailsMapper.getByOldClientId(oldClientId);
    }

    @Override
    public void updateClent(OauthClientDetails details) {
        oauthClientDetailsMapper.updateClent(details);
    }

    @Override
    public void saveClient(OauthClientDetails details) {
        oauthClientDetailsMapper.saveClient(details);
    }

    @Override
    public IPage<OauthClientDetails> slectByKey(Page page, OauthClientDetails key) {
        return oauthClientDetailsMapper.selectByKey(page,key);
    }
}